package com.sse.product.rbac.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author junyongli
 * @since 2022-07-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("rbac_user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "用户的id不能为空")
    private Long id;

    @NotBlank(message = "用户的名称(userName)不能为空!")
    @Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_]+$", message = "角色的名称只能包含中英文数字下划线")
    private String userName;

    @TableField
    private String password;

    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String mobile;

    private String passId;

    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String certSn;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime lastLogin;
    /**
     * 逻辑删除字段
     */
    @TableLogic(value = "0", delval = "1")
    @TableField(value = "delete_flag", fill = FieldFill.INSERT)
    private String deleteFlag = "0";
}
